<template>
  <el-card>
    <el-table
    :data="recordList"
    style="width: 100%">
    <el-table-column type="expand">
      <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">
          <el-form-item label="答案：">
            <span>{{ props.row.answer }}</span>
          </el-form-item>
        </el-form>
      </template>
    </el-table-column>
    <el-table-column
      label="序号"
      type="index">
    </el-table-column>
    <el-table-column
      label="题目名称"
      prop="questionContent">
    </el-table-column>
    <el-table-column
    width="180"
      label="答题时间"
      prop="answerTime">
    </el-table-column>
    </el-table>
    <el-pagination
    style="margin-top: 20px; text-align: center"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="queryInfo.current"
      :page-sizes="[8, 10, 15, 20]"
      :page-size="queryInfo.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </el-card>
</template>

<script>
import {answerRecord} from '@/api'
export default {
  data() {
    return {
      recordList:[],
      queryInfo:{
        current:1,
        size:8,
      },
      total:0
    }
  },
  mounted(){
    this.getRecord()
  },
  methods:{
    getRecord(){
      answerRecord(this.queryInfo).then(({data})=>{
        this.recordList = data.data.records
        this.total = data.data.total
        console.log(data);
      })
    },
    handleSizeChange(val){
      this.queryInfo.size = val
      this.getRecord()
    },
    handleCurrentChange(val){
      this.queryInfo.current = val
      this.getRecord()
    }
  }
};
</script>

<style>
</style>